#define rp_init
var dll;
dll = "RoketPackAPI.dll";

global.__rp_01 = external_define(dll, rp_mangle("RP_ApplicationIsInstalled", "R_SS"),  dll_cdecl, ty_real, 2, ty_string, ty_string);
global.__rp_02 = external_define(dll, rp_mangle("RP_ComponentInstall", "R_SSS"),       dll_cdecl, ty_real, 3, ty_string, ty_string, ty_string);
global.__rp_03 = external_define(dll, rp_mangle("RP_ComponentIsInstalled", "R_SSS"),   dll_cdecl, ty_real, 3, ty_string, ty_string, ty_string);
global.__rp_04 = external_define(dll, rp_mangle("RP_ComponentUninstall", "R_SSS"),     dll_cdecl, ty_real, 3, ty_string, ty_string, ty_string);
global.__rp_05 = external_define(dll, rp_mangle("RP_ComponentUpdate", "R_SSS"),        dll_cdecl, ty_real, 3, ty_string, ty_string, ty_string);
global.__rp_06 = external_define(dll, rp_mangle("RP_MiscellaneousCallUrl", "R_S"),     dll_cdecl, ty_real, 1, ty_string);
global.__rp_07 = external_define(dll, rp_mangle("RP_RoketPackIsAvailable", "R_V"),     dll_cdecl, ty_real, 0);
global.__rp_08 = external_define(dll, rp_mangle("RP_VersionGetAvailable", "R_SSS"),    dll_cdecl, ty_real, 3, ty_string, ty_string, ty_string);
global.__rp_09 = external_define(dll, rp_mangle("RP_VersionGetInstalled", "R_SSS"),    dll_cdecl, ty_real, 3, ty_string, ty_string, ty_string);
global.__rp_10 = external_define(dll, rp_mangle("RP_VersionIsLatest", "R_SSS"),        dll_cdecl, ty_real, 3, ty_string, ty_string, ty_string);

global.__rp_repo = "";
global.__rp_app = "";

#define rp_mangle
// Script which produces a mangled function name.

var funcname;
var signature;

funcname = argument0;
signature = argument1;

if (signature == "R_V")
    return "?" + funcname + "@@YANXZ";
else if (signature == "R_S")
    return "?" + funcname + "@@YANPBD@Z";
else if (signature == "R_SS")
    return "?" + funcname + "@@YANPBD0@Z";
else if (signature == "R_SSS")
    return "?" + funcname + "@@YANPBD00@Z";

#define rp_free
external_free("RoketPackGM.dll");

#define rp_application_is_installed
return external_call(global.__rp_01, global.__rp_repo, global.__rp_app);

#define rp_application_set
global.__rp_repo = argument0;
global.__rp_app = argument1;

#define rp_component_install
return external_call(global.__rp_02, global.__rp_repo, global.__rp_app, argument0);

#define rp_component_is_installed
return external_call(global.__rp_03, global.__rp_repo, global.__rp_app, argument0);

#define rp_component_uninstall
return external_call(global.__rp_04, global.__rp_repo, global.__rp_app, argument0);

#define rp_component_update
return external_call(global.__rp_05, global.__rp_repo, global.__rp_app, argument0);

#define rp_miscellaneous_call_url
return external_call(global.__rp_06, argument0);

#define rp_roketpack_is_available
return external_call(global.__rp_07);

#define rp_version_get_available
return external_call(global.__rp_08, global.__rp_repo, global.__rp_app, argument0);

#define rp_version_get_installed
return external_call(global.__rp_09, global.__rp_repo, global.__rp_app, argument0);

#define rp_version_is_latest
return external_call(global.__rp_10, global.__rp_repo, global.__rp_app, argument0);

#define rp_get_official_repository
return "https://pack.roket-enterprises.com/"

#define rp_get_experimental_repository
return "https://pack.roket-enterprises.com/experimental/"

#define app_get_info
rp_application_set(argument0, argument1);

apps_repo[apps_count] = argument0;
apps_name[apps_count] = argument1;
apps_component[apps_count] = argument2;
apps_installed[apps_count] = rp_application_is_installed();
apps_ver_available[apps_count] = rp_version_get_available(argument2);
apps_ver_installed[apps_count] = rp_version_get_installed(argument2);
apps_count += 1;

